Content starts here How To Create SOAP Handlers for Imported WSDLs
This page last changed on Nov 27, 2007.

Creating SOAP Handlers for Imported WSDLs

When you import metadata from web services for AquaLogic Data Services Platform, you can create SOAP handler for intercepting SOAP requests and responses. The handler will be invoked when a web service method is called. You can chain handlers that are invoked one after another in a specific sequence by defining the sequence in a configuration file.

To create and chain handlers, the following steps are involved:

  1. Create a Java Class Implementing the Generic Handler Interface
  2. Compile your intercept handler into a JAR file
  3. Define a Configuration File
  4. Define the Interceptor Configuration
  5. Concluding Actions

Create a Java Class Implementing the Generic Handler Interface

The GenericHandler interface is:

javax.xml.rpc.handler.GenericHandler
Code Sample: Intercept Handler

The following code illustrates an example of implementing a generic handler.

Example:
Intercept Handler

For detailed information on how to write handlers, refer to Creating and Using Client-Side SOAP Message Handlers in Weblogic 9.2 documentation.

Compile your intercept handler into a JAR file.

The steps are to compile your intercept handler and JAR the class file.

Define a Configuration File 

The configuration file specifies the handler chain and the order in which the handlers will be invoked.

Configuration File Schema
XML Schema for the Client-Side Handler Configuration File

The following is an example of the handler chain configuration. The handler-class attribute specifies the fully-qualified name of the
handler.

Code Sample: Handler Chain Configuration
<weblogic-wsee-clientHandlerChain
xmlns="http://www.bea.com/ns/weblogic/90"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:j2ee="http://java.sun.com/xml/ns/j2ee">
<handler>
	<j2ee:handler-name>sampleHandler</j2ee:handler-name>
	<j2ee:handler-class>WShandler.WShandler</j2ee:handler-class>
	<j2ee:init-param>
		<j2ee:param-name>ClientParam1</j2ee:param-name>
		<j2ee:param-value>value1</j2ee:param-value>
	</j2ee:init-param>
</handler>
</weblogic-wsee-clientHandlerChain>

Define the Interceptor Configuration

In your ALDSP application, define the interceptor configuration for the method in the data service to which you want to attach the handler.

Code Sample: Intercept Configuration 

datasrvc:Intercept Configuration

In the attached file the aliasName attribute specifies the name of the handler chain to be invoked and the fileName attribute specifies the location of the configuration file.

Concluding Actions

  • Place the JAR file that was based on the intercept handler (created above) in your project's dsp-inf/lib folder.
  • Compile and run your application. Your handlers will be invoked in the order specified in the configuration file.

Document generated by Confluence on Apr 28, 2008 15:54